feat:Update OpenAPI spec for image creation, model inputs, and event schemas#190
feat:Update OpenAPI spec for image creation, model inputs, and event schemas#190
Conversation
WalkthroughThe OpenAPI specification was updated to refine image creation endpoint responses, expand model input schemas to support both text and image inputs, add a new "in_progress" status to conversation items, and adjust event schemas to allow nullable Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
Client->>API: POST /image/generate or /image/edit
API-->>Client: Returns an image object
Client->>API: Send model input (text, image, or array of both)
API-->>Client: Processes input accordingly
API->>Client: Event with conversation item status (including "in_progress")
API-->>Client: Event with nullable previous_item_id
Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (17)
src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant3Type.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant3TypeNullable.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant4Type.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant4TypeNullable.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItem.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3Type.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4Type.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeConversationItemWithReference.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeConversationItemWithReferenceStatus.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeServerEventConversationItemCreated.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeServerEventInputAudioBufferCommitted.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/tryAGI.OpenAI/openapi.yaml(6 hunks)
🔇 Additional comments (1)
src/libs/tryAGI.OpenAI/openapi.yaml (1)
18069-18074: Verify downstream handling of newin_progressstatusAdding
in_progressis fine here, but please confirm all services, SDKs, and DB enum constraints accept the new value to avoid runtime rejections.
| group: images | ||
| name: Create image | ||
| returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.' | ||
| returns: 'Returns an [image](/docs/api-reference/images/object) object.' |
There was a problem hiding this comment.
Same mismatch for /images/generations
Replicate the fix above to keep both endpoints aligned.
- returns: 'Returns an [image](/docs/api-reference/images/object) object.'
+ returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml at line 2518, there is a mismatch issue
for the /images/generations endpoint similar to the one fixed previously. Review
the previous fix applied to the other endpoint and replicate the same
corrections here to ensure both endpoints are consistent and aligned in their
definitions.
| group: images | ||
| name: Create image edit | ||
| returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.' | ||
| returns: 'Returns an [image](/docs/api-reference/images/object) object.' |
There was a problem hiding this comment.
Return description now contradicts the response structure
The example payload still wraps the image(s) in a data array, yet the returns line was changed from “list of image objects” to a singular “image object”. This breaks consistency with both the payload and existing client expectations.
- returns: 'Returns an [image](/docs/api-reference/images/object) object.'
+ returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| returns: 'Returns an [image](/docs/api-reference/images/object) object.' | |
| returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.' |
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml at line 2485, the return description
states a singular "image object" but the example payload and client expectations
use a list of image objects wrapped in a `data` array. Update the return
description to indicate a list of image objects to match the example payload and
maintain consistency.
| detail: | ||
| type: string | ||
| description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n" | ||
| image_url: |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Constrain detail to its documented enum
Since the description limits detail to high | low | auto, encoding that in the schema helps validation and client generation.
- detail:
- type: string
- description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"
+ detail:
+ type: string
+ enum: [high, low, auto]
+ default: auto
+ description: "Detail level of the image sent to the model."\n📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| detail: | |
| type: string | |
| description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n" | |
| image_url: | |
| detail: | |
| type: string | |
| enum: [high, low, auto] | |
| default: auto | |
| description: "Detail level of the image sent to the model." |
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 12877 to 12880, the `detail`
field should be constrained to the enum values `high`, `low`, and `auto` as per
its description. Update the schema definition for `detail` to include an enum
property listing these three allowed string values. This will enforce validation
and improve client code generation by clearly specifying the permitted values.
| - title: An array of Input text and Input image | ||
| type: array | ||
| description: "A list of inputs, each of which may be either an input text or input image object.\n" | ||
| description: "Inputs to the model - can contain template strings.\n" |
There was a problem hiding this comment.
type: array without items makes the schema invalid
OpenAPI requires an items field for arrays. Without it, tools such as Swagger-UI and openapi-generator will fail.
- - title: An array of Input text and Input image
- type: array
- description: "A list of inputs, each of which may be either an input text or input image object.\n"
+ - title: An array of Input text and Input image
+ type: array
+ description: "A list of inputs, each of which may be either an input text or input image object.\n"
+ items:
+ oneOf:
+ - $ref: '#/components/schemas/Input text'
+ - $ref: '#/components/schemas/Input image'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - title: An array of Input text and Input image | |
| type: array | |
| description: "A list of inputs, each of which may be either an input text or input image object.\n" | |
| description: "Inputs to the model - can contain template strings.\n" | |
| - title: An array of Input text and Input image | |
| type: array | |
| description: "A list of inputs, each of which may be either an input text or input image object.\n" | |
| items: | |
| oneOf: | |
| - $ref: '#/components/schemas/Input text' | |
| - $ref: '#/components/schemas/Input image' |
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 12890 to 12893, the schema
defines a type as array but is missing the required items field. To fix this,
add an items property specifying the type or schema of the array elements to
make the OpenAPI schema valid and compatible with tools like Swagger-UI and
openapi-generator.
Summary by CodeRabbit
New Features
Improvements